package com.sxyc.tintin.model;

import java.util.Date;

import com.jfinal.plugin.activerecord.Model;

public class MediaUpload extends Model<MediaUpload> {

	public static final MediaUpload dao = new MediaUpload();

	// 使用jFinal 日志
	private com.jfinal.log.Log log = com.jfinal.log.Log.getLog(this.getClass());

	public boolean saveMediaUpload(MediaUpload mediaUpload) {
		boolean isSuccess = false;
		try {
			if (mediaUpload != null) {
				if (mediaUpload.get("Id") != null) {
					mediaUpload.set("UpdatedBy", "System");
					mediaUpload.set("UpdatedDate", new Date());
					isSuccess = mediaUpload.update();
				} else {
					mediaUpload.set("Remark", "自动导入");
					mediaUpload.set("Status", 1);
					mediaUpload.set("CreatedBy", "System");
					mediaUpload.set("CreatedDate", new Date());
					mediaUpload.set("UpdatedBy", "System");
					mediaUpload.set("UpdatedDate", new Date());
					isSuccess = mediaUpload.save();
				}
			}
		} catch (Exception e) {
			log.error("saveMediaUpload Exception ：" + e.getMessage());
		}
		return isSuccess;
	}

}
